package org.rxc.base.listener;

import org.rxc.base.service.IAutoScanPermissionService;
import org.springframework.beans.factory.annotation.Autowired;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;

@WebListener//交给springIOC容器
public class InitPermissionListener implements ServletContextListener {
    @Autowired
    private IAutoScanPermissionService autoScanPermissionService;
    @Override
    public void contextInitialized(ServletContextEvent sce) {
        System.out.println("------容器初识化开始-------");
        autoScanPermissionService.scan();
        System.out.println("------容器初识化结束-------");
    }

    @Override
    public void contextDestroyed(ServletContextEvent sce) {
        System.out.println("----------容器销毁执行-----");
    }
}
